from app.config.model_config import  EMBEDDING_MODEL
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
from typing import Any
from app.utils.singleton import Singleton,SignletonFunc
from app.config.model_config import  EMBEDDING_DEVICE_MAP
@SignletonFunc
class ComEmbeddings(HuggingFaceEmbeddings):
    def __init__(self,model_name=EMBEDDING_MODEL, 
                 model_kwargs={"device": EMBEDDING_DEVICE_MAP['embedding_model']},**kwargs: Any):
        super().__init__(model_name=model_name,model_kwargs=model_kwargs,**kwargs)



    # return HuggingFaceEmbeddings(
    # model_name=EMBEDDING_MODEL_DICT[EMBEDDING_MODEL], model_kwargs={"device": "cuda"},
    # )